package com.du

import java.util.Date;
import java.util.List;

class TestDB {
	
	private static TestDB instance

	public static synchronized TestDB getInstance() {
		
		if (instance == null) {
			return new TestDB()
		}
		return instance
	}
	
	public List orglist = new ArrayList<Org>()
	public List divisionslist = new ArrayList<Division>()
	public List projectslist = new ArrayList<Project>()
	public List personslist = new ArrayList<Person>()
	
	private TestDB() {
	
		// Persons
		
		Person p1 = new Person();
		p1.name = "John Gardner";
		p1.email = "john.gardner@duorg.com"
		p1.birthDay = new Date(1970,5,15)
		p1.hiredDay = new Date(2009,1,5)
		personslist.add(p1)
		
		Person p2 = new Person()
		p2.name = "Bill Murrey"
		p2.email = "bill.murrey@duorg.com"
		p2.birthDay = new Date(1974,3,21)
		p2.hiredDay = new Date(2010,4,9)
		personslist.add(p2)
		
		Person p3 = new Person()
		p3.name = "Sanny Goldberg"
		p3.email = "sanny.goldberg@duorg.com"
		p3.birthDay = new Date(1982,11,1)
		p3.hiredDay = new Date(2009,6,19)
		personslist.add(p3)
		
		Person p4 = new Person()
		p4.name = "Simon Gunya"
		p4.email = "simon.gunya@duorg.com"
		p4.birthDay = new Date(1959,5,20)
		p4.hiredDay = new Date(2005,6,1)
		personslist.add(p4)
		
		Person p5 = new Person()
		p5.name = "Siguny Uivers"
		p5.email = "siguny.uivers@duorg.com"
		p5.birthDay = new Date(1971,1,17)
		p5.hiredDay = new Date(2006,12,1)
		personslist.add(p5)
		
		Person p6 = new Person()
		p6.name = "James Gosling"
		p6.email = "james.gosling@duorg.com"
		p6.birthDay = new Date(1979,7,30)
		p6.hiredDay = new Date(2011,3,5)
		personslist.add(p6)
		
		Person p7 = new Person()
		p7.name = "Michael Sucsy"
		p7.email = "michael.sucsy@duorg.com"
		p7.birthDay = new Date(1955,1,20)
		p7.hiredDay = new Date(2003,2,15)
		personslist.add(p7)
		
		Person p8 = new Person()
		p8.name = "Abby Kohn"
		p8.email = "abby.kohn@duorg.com"
		p8.birthDay = new Date(1988,7,30)
		p8.hiredDay = new Date(2012,1,15)
		personslist.add(p8)
		
		Person p9 = new Person()
		p9.name = "Jason Katims"
		p9.email = "jason.katims@duorg.com"
		p9.birthDay = new Date(1968,4,4)
		p9.hiredDay = new Date(2002,12,1)
		personslist.add(p9)
		
		Person p10 = new Person()
		p10.name = "Channing Tatum"
		p10.email = "channing.tatum@duorg.com"
		p10.birthDay = new Date(1970,12,3)
		p10.hiredDay = new Date(2008,11,11)
		personslist.add(p10)
		
		Person p11 = new Person()
		p11.name = "Sam Neill"
		p11.email = "sam.neill@duorg.com"
		p11.birthDay = new Date(1978,3,1)
		p11.hiredDay = new Date(2009,10,11)
		personslist.add(p11)
		
		Person p12 = new Person()
		p12.name = "Rachel McAdams"
		p12.email = "rachel.mcAdams@duorg.com"
		p12.birthDay = new Date(1979,9,29)
		p12.hiredDay = new Date(2008,11,12)
		personslist.add(p12)
		
		// Projects
		
		Project prA1 = new Project()
		prA1.title = "Project A1"
		prA1.email = "projectA1@duorg.com"
		prA1.startDay = new Date()
		prA1.managers.add(p4)
		prA1.managers.add(p5)
		prA1.developers.add(p9)
		prA1.developers.add(p10)
		p9.inProjects.add(prA1)
		p10.inProjects.add(prA1)
		projectslist.add(prA1)
		
		Project prA2 = new Project()
		prA2.title = "Project A2"
		prA2.email = "projectA2@duorg.com"
		prA2.startDay = new Date()
		prA2.managers.add(p6)
		prA2.developers.add(p9)
		prA2.developers.add(p10)
		p9.inProjects.add(prA2)
		p10.inProjects.add(prA2)
		projectslist.add(prA2)
		
		Project prB1 = new Project()
		prB1.title = "Project B1"
		prB1.email = "projectB1@duorg.com"
		prB1.startDay = new Date()
		prB1.managers.add(p7)
		prB1.developers.add(p11)
		p11.inProjects.add(prB1)
		projectslist.add(prB1)
		
		Project prB2 = new Project()
		prB2.title = "Project B2"
		prB2.email = "projectB2@duorg.com"
		prB2.startDay = new Date()
		prB2.managers.add(p8)
		prB2.developers.add(p11)
		prB2.developers.add(p12)
		p11.inProjects.add(prB2)
		p12.inProjects.add(prB2)
		projectslist.add(prB2)
		
		// Divisions
		
		Division divA = new Division()
		divA.title = "DivisionA"
		divA.email = "divisiona@duorg.com"
		divA.dateCreated = new Date(2011,3,21)
		divA.head = p2
		divA.projects.add(prA1)
		divA.projects.add(prA2)
		divisionslist.add(divA)
		
		Division divB = new Division()
		divB.title = "DivisionB"
		divB.email = "divisionb@duorg.com"
		divB.dateCreated = new Date(2010,1,11)
		divB.head = p3
		divB.projects.add(prB1)
		divB.projects.add(prB2)
		divisionslist.add(divB)
		
		// Organization
		
		Org aOrg = new Org()
		aOrg.title = "DU Organization"
		aOrg.email = "duorgmain@duorg.com"
		aOrg.startDay = new Date(2001,1,18)
		aOrg.head = p1
		aOrg.divisions.add(divA)
		aOrg.divisions.add(divB)
		orglist.add(aOrg)
	}

}
